package jym.tan.movielibrary.component.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import jym.tan.movielibrary.component.ui.table.model.MovieSearchResultTableModel;
import jym.tan.movielibrary.factory.ComponentFactory;
import jym.tan.movielibrary.factory.ModelFactory;
import jym.tan.movielibrary.model.MovieSearchModel;

public class SingleMovieAddListener implements ActionListener {

	private static final long serialVersionUID = 13L;

	public void actionPerformed(ActionEvent e) {		
		MovieSearchResultTableModel movieSearchResultTableModel = (MovieSearchResultTableModel) ModelFactory.getMovieSearchResultTableModel();
		movieSearchResultTableModel.setMovieSearchModels(new ArrayList<MovieSearchModel>(0));
		movieSearchResultTableModel.fireTableDataChanged();
		
		ComponentFactory.getAddSingleFolderTextField().setText("");
		ComponentFactory.getSingleFolderChooser().setSelectedFile(null);
		MovieSearchModel movieSearchModel = null;
		ComponentFactory.getMovieSearchInfoPanel().update(movieSearchModel);
		ComponentFactory.getSingleMovieAddDialog().setVisible(true);				
	}
}
